package com.zxp.server.config;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class Result {
    private String state;
    private String message;
    private Object data;


    /**
     * 成功返回结果
     * @param message
     * @return
     */
    public static Result success(String message){
        return new Result("success",message,null);
    }
    /**
     * 成功返回结果
     * @param message
     * @param obj
     * @return
     */
    public static Result success(String message,Object obj){
        return new Result("success",message,obj);
    }



    /**
     * 失败返回结果
     * @param message
     * @return
     */
    public static Result error(String message){
        return new Result("error",message,null);
    }

    /**
     * 失败返回结果
     * @param message
     * @param obj
     * @return
     */
    public static Result error(String message,Object obj){
        return new Result("error",message,obj);
    }

}
